import time
import datetime
from datetime import timedelta


class ToCatch:

    def caltime(self, date1, date2):
        '''
        两个时间之间的差值
        :param date1: 开始时间
        :param date2: 结束时间
        :return: int类型
        '''
        date1 = time.strptime(date1, '%Y-%m-%d')
        date2 = time.strptime(date2, '%Y-%m-%d')
        '''0下标表示年，1下标表示月，2下标表示日'''
        date1 = datetime.datetime(date1[0], date1[1], date1[2])
        date2 = datetime.datetime(date2[0], date2[1], date2[2])

        return (date2 - date1).days

    def saturday(self):
        '''
        判断最近的周末（判断周六）
        :return:
        '''

        now = datetime.datetime.now()
        this_week_end = now + timedelta(days=5 - now.weekday())
        result = (str(this_week_end.year) + '-' + str(this_week_end.month) + '-' + str(this_week_end.day))
        return result

    def get_weekday(self, date):
        week = {0: '一', 1: '二', 2: '三', 3: '四', 4: '五', 5: '六', 6: '日'}
        week_day = datetime.datetime.strptime(date, '%Y-%m-%d').weekday()
        return f'{date}星期{week[week_day]}'

    def today(self):
        today = (str(datetime.datetime.now().year) + "-" + str(datetime.datetime.now().month) + "-" + str(
            datetime.datetime.now().day))
        return today

    def holidays(self):
        holidays = [
            ['周末', self.saturday()],
            ['春节', '2023-01-22'],
            ['情人节', '2022-02-14'],
            ['愚人节', '2022-04-01'],
            ['清明节', '2022-04-05'],
            ['劳动节', '2022-05-01'],
            ['端午节', '2022-06-03'],
            ['中秋节', '2022-09-10'],
            ['国庆节', '2022-10-01'],
            ['圣诞节', '2022-12-25'],
            ['元旦', '2023-01-01'],
        ]
        return holidays

    def main(self):
        str_1 = '[摸鱼办提醒您]:今天是' + self.get_weekday(
            self.today()) + '，冬季寒冷，注意保暖，少喝凉水。工作再累，一定不要忘记摸鱼哦！有事没事起身去茶水间，去厕所，去廊道走走别老在工位上坐着，钱是老板的,但命是自己的。'
        str_3 = '认认真真上班，这根本就不叫赚钱，那是用劳动换取报酬。只有偷懒，在上班的时候摸鱼划水，你才是从老板手里赚到了钱。最后，祝愿天下所有摸鱼人都能愉快的渡过每一天！'
        print(str_1)
        for i in self.holidays():
            print("距离" + i[0] + "还有" + str(self.caltime(self.today(), i[1])) + "天")
        print(str_3)


if __name__ == '__main__':
    c = ToCatch()
    c.main()
